package com.googlecode.alfrescocachingserver.model.schemas.util;

import java.util.List;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import com.googlecode.alfrescocachingserver.model.schemas.ObjectFactory;
import com.googlecode.alfrescocachingserver.model.schemas.WebScriptUriTemplate;
import com.googlecode.alfrescocachingserver.model.schemas.WebScriptUriTemplates;

public class WebScriptUriTemplatesListAdapter extends XmlAdapter<WebScriptUriTemplates, List<WebScriptUriTemplate>>
{
    @Override
    public List<WebScriptUriTemplate> unmarshal(WebScriptUriTemplates webScriptUris) throws Exception
    {
        return webScriptUris.getUriTemplates();
    }

    @Override
    public WebScriptUriTemplates marshal(List<WebScriptUriTemplate> webScriptUriTemplateList) throws Exception
    {
        ObjectFactory objectFactory = new ObjectFactory();
        
        WebScriptUriTemplates webScriptUriTemplates = objectFactory.createWebScriptUriTemplates();

        webScriptUriTemplates.setUriTemplates(webScriptUriTemplateList);
        
        return webScriptUriTemplates;
    }
}
